package com.tmxk.jdbc04.constants;

/**
 * 行程状态枚举类
 */
public enum ScheduleStatus {
    ONE(0, "未出行"),
    TWO(1, "已取消"),
    THREE(2,"已出行");

    private int code;
    private String value;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    ScheduleStatus(int code, String value) {
        this.code = code;
        this.value = value;
    }

    /**
     * 对外提供的公共获取对应枚举类的方法
     */
    public static ScheduleStatus getScheduleStatusByCode(int code) {
        switch (code) {
            case 0:
                return ONE;
            case 1:
                return TWO;
            default:
                return ONE;
        }
    }
}
